4461e9555478624fcf0b1880789391bf6a2cb30f,src/com/redhat/ceylon/tools/copy/CeylonCopyTool.java,CeylonCopyTool,copyModule,#ModuleSpec#Set#,165
Before Change
ModuleVersionDetails ver = versions.iterator().next();
msg("copying.module", module).newline().flush();
boolean foundCar = true;
for (String suffix : artifacts) {
// if we found a car we can skip the jar and module descriptors
if(foundCar
&& (suffix.equals(ArtifactContext.JAR)
|| suffix.equals(ArtifactContext.MODULE_PROPERTIES)
|| suffix.equals(ArtifactContext.MODULE_XML)))
continue;
ArtifactContext ac = new ArtifactContext(module.getName(), module.getVersion(), suffix);
ac.setThrowErrorIfMissing(false);
ArtifactResult srcArchive = getRepositoryManager().getArtifactResult(ac);
if (srcArchive != null) {
copyArtifact(ac, srcArchive.artifact());
// if we found a car we can skip the jar and module descriptors
if(suffix.equals(ArtifactContext.CAR))
After Change
if (!versions.isEmpty()) {
ModuleVersionDetails ver = versions.iterator().next();
msg("copying.module", module).newline().flush();
ArtifactResult result = null;
Set<String> suffixes = new LinkedHashSet<String>(artifacts);
while (!suffixes.isEmpty()) {
// Try to get one of the artifacts
String[] sfx = new String[suffixes.size()];
sfx = suffixes.toArray(sfx);
ArtifactContext ac;
if (result == null) {
ac = new ArtifactContext(module.getName(), module.getVersion(), sfx);
} else {
// We re-use the previous result so we can efficiently
// retrieve further artifacts from the same module
ac = result.getSiblingArtifact(sfx);
}
ac.setThrowErrorIfMissing(false);
result = getRepositoryManager().getArtifactResult(ac);
if (result != null) {
// Set the proper suffix for the copy operation
String suffix = ArtifactContext.getSuffixFromFilename(result.artifact().getName());
ac.setSuffixes(suffix);
// Perform the actual copying
copyArtifact(ac, result.artifact());
// make sure we don't try to get the same artifact twice
suffixes.remove(suffix);
// if we found a car we can skip the jar and module descriptors
if (suffix.equals(ArtifactContext.CAR)) {
suffixes.remove(ArtifactContext.JAR);
suffixes.remove(ArtifactContext.MODULE_PROPERTIES);
suffixes.remove(ArtifactContext.MODULE_XML);
}